<template>
  <div class="message-container" v-show="visible">
    <div class="message-wrapper">
      <div  class="message-content">
        <h6>{{ title }}</h6>
        <div>{{ message }}</div>
        <button class="message-button" @click="onClickSure">确定</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      title: "标题",
      message: "一条信息",
      visible: false,
    };
  },
  methods: {
    onClickSure() {
      this.visible = false;
    },
  },
};
</script>  

<style scoped>
.message-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  left: 0px;
  top: 0px;
  z-index: 999;
}
.message-wrapper {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: inline-flex;
  justify-content: center;
  align-items: center;
}
.message-content {
  width: 50%;
  height:120px;
  display: inline-flex;
  background-color: lightgray;
  align-items: center;
  justify-content: center;
}
.message-button {
  width: 60%;
  height: 25px;
  background-color: blue;
  color: white;
}
</style>